Home / Python / Functions
Functions & Modules
Mark CompleteWrite reusable functions and organize code with modules.
Functions
def add(a, b):
return a + b
total = add(5, 7)
Modules
import math
print(math.sqrt(16))
Key takeaway: keep functions small and focused.
Ready to try it yourself?
Write a function and call it.
← Control Flow
File Handling →